#include "namepipe.hpp"

int main()
{
    int fd = open("pipe",O_WRONLY);
    if(fd == -1)
    {
        perror("open");
        return 1;
    }

    char arr[1024];
    fgets(arr,sizeof(arr),stdin);
    arr[strlen(arr) - 1] = 0;

    while(1)
    {
        int ret = write(fd,arr,sizeof(arr) - 1);
        if(ret == -1)
        {
            perror("read");
            return 1;
        }
        sleep(1);
    }
    return 0;
}